<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <style>
  html, body {
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#container {
  width: 100%;
  height: 100%;
  background: black;
}

#container canvas{
  width: 100%;
  height: 100%;
}
  </style>
</head>
<body>
  <div id="container">
    <canvas></canvas>
  </div>
  <script src="/js/sprite-core.js"></script>

  <script>
  const img = new Image();
  img.onload = function () {
    const {Layer, Sprite} = spritejs;

    const context = document.querySelector('#container canvas').getContext('2d');
    context.canvas.width = window.innerWidth;
    context.canvas.height = window.innerHeight;
    const layer = new Layer({context});
    const {width, height} = context.canvas;
    const sprite = new Sprite({
      pos: [0, 10],
      // textures: [{image:img}],
      textures: [img],
      width,
    });

    layer.append(sprite);

    // window.addEventListener('resize', evt => {
    //   scene.setViewport('auto', 'auto')
    //   const [w, h] = scene.viewport
    //   scene.setResolution(w, h)
    //   sprite.attr('width', w)
    // })
  };
  img.src = '';
  </script>
</body>
</html>